using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using Entities;
using DAL;
using System.Data.SqlClient;
using System.Data;

namespace BUS
{
    public class tbTrangThai_SanPhamBUS
    {
        public static void Insert(tbTrangThai_SanPhamEntities TTSP)
        {
            tbTrangThai_SanPhamDAL TTSPDAL = new tbTrangThai_SanPhamDAL();
            TTSPDAL.Insert(TTSP);
        }

        public static void Update(tbTrangThai_SanPhamEntities TTSP)
        {
            tbTrangThai_SanPhamDAL TTSPDAL = new tbTrangThai_SanPhamDAL();
            TTSPDAL.Insert(TTSP);
        }

        public static void Delete(int iD)
        {
            tbTrangThai_SanPhamDAL TTSPDAL = new tbTrangThai_SanPhamDAL();
            TTSPDAL.Delete(iD);
        }

        public static Entities.tbTrangThai_SanPhamEntities.tbTrangThai_SanPhamColection Get(string where, int pageindex, int pagesize, string orderby, string orderdirection, out int total)
        {
            tbTrangThai_SanPhamDAL TTSPDAL = new tbTrangThai_SanPhamDAL();
            return TTSPDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }

        public static Entities.tbTrangThai_SanPhamEntities.tbTrangThai_SanPhamColection GetAll()
        {
            int total = 0;
            tbTrangThai_SanPhamDAL TTSPDAL = new tbTrangThai_SanPhamDAL();
            return TTSPDAL.Get("where 1=1", 0, 0, Entities.tbTrangThai_SanPhamEntities.tbTrangThai_SanPhamColumn.MaTT.ToString(), "ASC", out total);
        }

        public static tbTrangThai_SanPhamEntities GetByID(int iD)
        {
            int total = 0;
            tbTrangThai_SanPhamDAL TTSPDAL = new tbTrangThai_SanPhamDAL();
            Entities.tbTrangThai_SanPhamEntities.tbTrangThai_SanPhamColection TTSPCollection = TTSPDAL.Get("where " + Entities.tbTrangThai_SanPhamEntities.tbTrangThai_SanPhamColumn.MaTT.ToString() + "=" + iD.ToString(), 0, 0, Entities.tbTrangThai_SanPhamEntities.tbTrangThai_SanPhamColumn.MaTT.ToString(), "ASC", out total);
            if (TTSPCollection.Count > 0)
                return TTSPCollection[0];
            return null;
        }
    }
}
